package Code.Objects.Characters.Player.Weapons.Ranged.Energy;

import org.jrabbit.standard.game.graphics.skins.animation.AnimatedSkin;

import Code.Objects.Characters.Player.Player;
import Code.Objects.Characters.Player.Weapons.PlayerWeapon;

public class EnergyWeapon extends PlayerWeapon
{
	private double energy;
	private double maxEnergy;

	public EnergyWeapon(AnimatedSkin skin, Player p)
	{
		super(skin, p);
		
		energy = 100;
		maxEnergy = 100;
	}

	public double getEnergy()
	{
		return energy;
	}

	public double getMaxEnergy()
	{
		return maxEnergy;
	}
	
	public void defineEnergy(double e)
	{
		energy = maxEnergy = e;
	}
	
	public void gainEnergy(double amount)
	{
		energy += amount;
		validateEnergy();
	}
	
	public void loseEnergy(double amount)
	{
		energy -= amount;
		validateEnergy();
	}
	
	protected void validateEnergy()
	{
		if(energy < 0)
		{
			energy = 0;
		}
		else if(energy > maxEnergy)
		{
			energy = maxEnergy;
		}
	}
}
